package com.example.doer.reading.AppAdapters;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.doer.reading.AppDataModel.Book;
import com.example.doer.reading.R;

import java.util.List;

/**
 * Created by pc on 2017/7/20.
 */

public class OtherBookAdapter extends BaseAdapter{

    Context context;
    List<Book> list;
    int res;
    public OtherBookAdapter(Context c, List<Book> l, int r)
    {
        this.context = c;
        this.list = l;
        this.res = r;
    }
    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = LayoutInflater.from(context).inflate(res,null);
        ImageView  imageView = (ImageView) view.findViewById(R.id.iv_otherbook);
        TextView tv_otherBookName = (TextView) view.findViewById(R.id.tv_otherbookName);


        return view;
    }
}
